<template>
  <section class="xmv-button xmv-wrap">
    <h4>datetime-picker</h4>
    <div class="demo-markup-source u-letter-box--small c-text">
      <button type="button" class="c-button" @click="open('picker1')">Button</button>
    </div>
    <div class="demo-markup-source u-letter-box--small">
      <pre class="c-pre">
        <code class="c-code c-code--multiline html hljs xml">
&ltxm-datetime-picker
  ref="picker1"
  v-model="value"
  type="date"
  @confirm="handleChange"&gt
&lt/xm-datetime-picker&gt

export default {
  data() {
    return {
      value: null
    };
  },
  methods: {
    open(picker) {
      this.$refs[picker].open();
    },

    handleChange(value) {
      this.$toast({
        message: "已选择 " + value.toString(),
        position: "bottom"
      });
    }
  }
};
        </code>
      </pre>
    </div>
    <xm-datetime-picker
      ref="picker1"
      v-model="value"
      type="date"
      @confirm="handleChange">
    </xm-datetime-picker>
  </section>
</template>
<script>
export default {
  data() {
    return {
      value: null
    };
  },
  methods: {
    open(picker) {
      this.$refs[picker].open();
    },

    handleChange(value) {
      this.$toast({
        message: "已选择 " + value.toString(),
        position: "bottom"
      });
    }
  }
};
</script>

<style lang="less" scoped>
h4 {
  font-weight: normal;
  font-size: 14px;
  text-align: left;
  background-color: #e9e9e9;
  padding: 10px;
  margin: 20px 0;
}
p {
  text-align: left;
  padding: 0.5em 0;
}
.c-code--multiline {
  display: block;
  padding: 0.5em 1em;
  border-radius: 4px;
  white-space: pre;
  word-wrap: normal;
  overflow-x: auto;
}
.demo-markup-source {
  text-align: left;
}
.c-code {
  font-size: 0.8em;
}
</style>